<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html>
<html>
<head>
<title></title>

<meta name="viewport" content="width=device-width, initial-scale=1.0"
	charset="utf-8">
<!-- 引入bootstrap -->
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/bootstrap.min.css">
<!-- 引入JQuery  bootstrap.js-->
<script src="${pageContext.request.contextPath}/js/jquery-3.2.1.min.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/js/caseoperation.js"></script>
<script src="${pageContext.request.contextPath}/js/cases.js"></script>

</head>
<body>
	<!-- 顶栏 -->
	<jsp:include page="../admin/top.jsp"></jsp:include>
	<!-- 中间主体 -->
	<div class="container" id="content">
		<div class="row">
			<%@ include file="/WEB-INF/jsp/admin/menu.jsp"%>
			<div class="col-md-10">
				<div class="panel panel-default">
					<div class="panel-heading">
						<div class="row">
							<h1 style="text-align: center;">添加用例</h1>
						</div>
					</div>
					<div class="panel-body">
						<form class="form-horizontal" role="form"
							action="${pageContext.request.contextPath}/cases/addCase"
							id="editfrom" method="post">

							<div class="form-group">
								<td><label for="inputEmail3" class="col-sm-2 control-label">用例名称：</label></td>
								<td><input id="caseName" name="caseName" type="text"
									value="" style="width: 230px;" class="form-control"
									placeholder="请输入用例名称" /></td>
							</div>
	
							<div class="form-group">
								<td><label for="inputEmail3" class="col-sm-2 control-label">用例编号：</label></td>
								<td><input id="caseNum" name="caseNum" type="text"
									value="" style="width: 230px;" class="form-control"
									placeholder="请填写用例编号" /></td>
							</div>
							<div class="form-group">
								<label for="inputPassword3" class="col-sm-2 control-label"
									name="itemId">运行环境：</label>
								<div class="col-sm-10">
									<select class="form-control" name="envId" id="envId"
										style="width: 55%">
										<option value="0">请选择</option>
										<c:forEach var="envList" items="${envList}">
											<option value="${envList.id}">${envList.name}</option>
										</c:forEach>
									</select>
								</div>
							</div>
						
							<div class="form-group">
								<label for="inputPassword3" class="col-sm-2 control-label"
									name="itemId">接口：</label>
								<div class="col-sm-10">
									<td><select class="form-control" name="portId" id="portId"
										style="width: 55%">
											<option value="0">请选择</option>
											<c:forEach var="casePortList" items="${casePortList}">
												<option value="${casePortList.id}">${casePortList.portName}</option>
											</c:forEach>
									</select></td>
									<td><input type="button" class="btn btn-primary"
										value="运行" onclick="runcase()"></td>
								</div>
							</div>


							<div class="form-group">
								<td><label for="inputPassword3"
									class="col-sm-2 control-label">返回结果：</label></td>
								<td><textarea style="overflow-x" rows="15" cols="100"
										id="result" name="result"></textarea></td>
							</div>

							<div class="form-group">
								<label class="col-sm-2 control-label">验证参数：</label>
								<div class="col-sm-8">
									<button id="add_request_body" class="btn btn-primary"
										type="button">
										<i class="fa fa-plus-square-o"></i>&nbsp;添加行
									</button>
								</div>
								<div class="col-sm-offset-2 col-sm-8">
									<table id="request_body" class="table col-sm-10">
										<thead>
											<tr>
												<th>参数名</th>
												<th>期望值</th>
												<th></th>
											</tr>
										</thead>
										<tbody>
										</tbody>
									</table>
								</div>
							</div>


							<div class="form-group">
								<td><label for="inputPassword3"
									class="col-sm-2 control-label">用例描述：</label></td>
								<td><textarea rows="3" cols="40" id="remark" name="remark"></textarea>
								</td>
							</div>

							<div class="form-group">
								<td><label for="inputEmail3" class="col-sm-2 control-label">步骤：</label></td>
								<td><input id="caseStep" name="caseStep" type="text"
									value="" style="width: 200px;" class="form-control"
									placeholder="不填执行单个接口用例" /></td>
							</div>
						

							<div class="form-group">
								<td><label for="inputPassword3"
									class="col-sm-2 control-label">启用状态：</label></td>
								<td><label class="checkbox-inline"> <input
										type="radio" name="status" value="1" checked>启用
								</label> <label class="checkbox-inline"> <input type="radio"
										name="status" value="0">不启用</td> </label>
							</div>
							</br> </br>

							<div class="form-group" style="text-align: center">
								<input type="button" class="btn btn-primary" value="提交"
									onclick="addcase()">
								<button class="btn btn-default" type="reset">重置</button>
							</div>
						</form>
					</div>

				</div>

			</div>
		</div>
	</div>
	<div class="container" id="footer">
		<div class="row">
			<div class="col-md-12"></div>
		</div>
	</div>
</body>
<script type="text/javascript">
	$("#nav li:nth-child(3)").addClass("active")
</script>
</html>